package com.javasm.bootcrud01.UserAccess.service.impl;

import com.javasm.bootcrud01.UserAccess.entity.UserAccessLog;
import com.javasm.bootcrud01.UserAccess.dao.UserAccessLogDao;
import com.javasm.bootcrud01.UserAccess.service.UserAccessLogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * (UserAccessLog)表服务实现类
 *
 * @author makejava
 * @since 2025-07-06 13:43:29
 */
@Service("userAccessLogService")
public class UserAccessLogServiceImpl implements UserAccessLogService {
    @Resource
    private UserAccessLogDao userAccessLogDao;

    /**
     * 通过ID查询单条数据
     *
     * @param logId 主键
     * @return 实例对象
     */
    @Override
    public UserAccessLog queryById(Integer logId) {
        return this.userAccessLogDao.queryById(logId);
    }

      /**
     * 新增数据
     *
     * @param userAccessLog 实例对象
     * @return 实例对象
     */
    @Override
    public UserAccessLog insert(UserAccessLog userAccessLog) {
        this.userAccessLogDao.insert(userAccessLog);
        return userAccessLog;
    }

    /**
     * 修改数据
     *
     * @param userAccessLog 实例对象
     * @return 实例对象
     */
    @Override
    public UserAccessLog update(UserAccessLog userAccessLog) {
        this.userAccessLogDao.update(userAccessLog);
        return this.queryById(userAccessLog.getLogId());
    }

    /**
     * 通过主键删除数据
     *
     * @param logId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer logId) {
        return this.userAccessLogDao.deleteById(logId) > 0;
    }
}
